
<template>
    <div class="exempt-penalty-interest">
        <Card>
            <interestForm
                :formValidate="formValidate"
                @getList="getList"
                :processStatusDict="processStatusDict"
                :contractStatusDict="contractStatusDict"
                :processModeDict="processModeDict"
                :handleSubmit="handleSubmit"
            />
            <div class="interestTable">

                <interestTable
                    :contractTable="contractTable"
                    @getList="getList"
                    :processStatusDict="processStatusDict"
                    :contractStatusDict="contractStatusDict"
                    :processModeDict="processModeDict"
                />
            </div>
        </Card>
    </div>
</template>
<script>
    import {findMulticondition} from "_p/basic/api/contract/fee-waiver/batch-penalty-exempt/batch-penalty-exempt";
    import {getDictDataByType} from "_p/basic/api/admin/datadic";

    import interestForm from "./components/form";
    import interestTable from "./components/table";

    export default {
    name: "ExemptPenaltyInterest",
    components: { interestForm, interestTable },
    props: {},
    data() {
        return {
            loading: false,
            // 日期区间
            isDateErr: false,
            endTime: "",
            formValidate: {
                amount: "", //溢缴款
                applyNo: "", // 申请编号
                caseNo: "", // 案件编号
                closeDate: "", // 合同关闭日期
                contactNo: "", // 联系方式
                contractNo: "", // 合同号
                contractStatus: "", // 合同状态
                createTime: "", //	string($date-time) // 申请时间
                custName: "", // 客户姓名
                endTime: "", //	string($date-time) // 结束时间
                id: "", // id
                pageNumber: 1, // integer($int32) // 当前页
                pageSize: 50, //integer($int32) // 多少条
                processMode: "", // 处理方式
                processStatus: null // 处理状态
            },
            ruleInline: {
                // endTime: [{ validator: validateEndDate, trigger: "change" }],
                // createTime: [
                //     { validator: validateStartDate, trigger: "change" }
                // ]
            },

            contractTable: {
                current: 1, // 表格当前页
                pages: 0,
                searchCount: false,
                size: 10,
                total: 0,
                orders: [],
                records: []
            },
            pageSizeOpts: [10, 20, 50, 100],
            // selct 数据字典
            processStatusDict: [],
            contractStatusDict: [],
            processModeDict: []
        };
    },
    mounted() {
        this.init();
    },
    methods: {
        init() {
            // 数据字典
            getDictDataByType("processStatus").then(res => {
                if (res.code === "0000") {
                    this.processStatusDict = res.data;
                }
            });
            getDictDataByType("contractStatus").then(res => {
                if (res.code === "0000") {
                    this.contractStatusDict = [].concat(res.data);
                }
            });
            getDictDataByType("processMode").then(res => {
                if (res.code === "0000") {
                    this.processModeDict = [].concat(res.data);
                }
            });
        },
        // 查询
        handleSubmit(name) {
            this.$refs[name].validate(valid => {
                if (valid) {
                    this.loading = true;
                    this.getList(this.formValidate);
                }
            });
        },
        handleReset(name) {
            this.$refs[name].resetFields();
        },
        getList(data) {
            findMulticondition(data).then(res => {
                this.loading = false;
                if (res.code === "0000") {
                    this.contractTable = res.data;
                    this.$Message.success("Success!");
                } else {
                    this.$Message.error("Fail!");
                }
            });
        },

        // 分页 Fn
        changePageSize(num) {
            this.getList(
                Object.assign({}, this.formValidate, { pageSize: num })
            );
            this.formValidate.pageSize = num;
        },
        changePage(num) {
            this.getList(
                Object.assign({}, this.formValidate, { pageNumber: num })
            );
            this.formValidate.pageNumber = num;
        }
    },
    computed: {}
};
</script>
<style lang="less" >
@import url("../../../../styles/common/form.less");
.exempt-penalty-interest {
    .interestTable {
        padding-top: 16px;
    }
}
</style>
